<?php


namespace app\common\model;


class MemberCashLog extends Base
{
    protected $table = "maniac_member_cash_log";
    protected $createTime = "created_at";
    protected $updateTime = "updated_at";

    public function member(){
        return $this->hasOne('app\common\model','id','user_id');
    }
    public function memberCash(){
        return $this->hasOne('app\common\model\MemberCash','id','cash_id');
    }
    //获取昵称
    public function getNicknameAttr($value,$data){
        return Members::where("id",$data['user_id'])->field('id,nickname')->find()['nickname'];
    }
    //获取头像
    public function getHeadimgurlAttr($value,$data){
        return Members::where("id",$data['user_id'])->field('id,image_uri')->find()['image_uri'];
    }
    //获取商铺名称
    public function getBusinessNameAttr($value,$data){
        return Business::where("id",$data['business_id'])->field('id,business_name')->find()['business_name'];
    }
    //状态
    public function getStatusTxtAttr($value,$data){
        $status = [0=>'申请中',1=>"审核通过",2=>"审核不通过"];
        return $status[$data['status']];
    }
    //提现方式
    public function getWithdrawalMethodAttr($value,$data){
        $type = [0=>'微信',1=>"银行卡"];
        return $type[$data['type']];
    }
}